<?php
//begin search
/*$this->db->like('c_org_title',$keyword,'both');
$this->db->like('c_org_date',$date_choose,'after');
$this->db->like('org_id',$major);

$query = $this->db->get('content_of_organization');*/

$query = $this->db->query("SELECT content_of_organization.c_org_title, content_of_organization.c_org_id, EXTRACT(YEAR FROM content_of_organization.c_org_date) as years, EXTRACT(MONTH FROM content_of_organization.c_org_date) AS months, EXTRACT(DAY FROM content_of_organization.c_org_date) AS dates , organization.org_name, organization.org_description, membership.firstname, membership.lastname FROM content_of_organization, organization, membership where (content_of_organization.org_id=organization.org_id) AND (content_of_organization.member_id=membership.member_id) AND (content_of_organization.c_org_title like '%".$keyword."%') AND (content_of_organization.c_org_date like '".$date_choose."%') AND (content_of_organization.org_id like '".$major."')");

$num_rows = $query->num_rows();
?>

<div id="result_query_search" style="padding-left:16px; font-size:13px; color:#999999;"><img src="<?=base_url()?>images/graphic/magnifier-zoom-actual-equal.png" style="vertical-align:middle;"/> ผลลัพธ์การค้นหาพบ <?=$num_rows?> รายการ (<?=$this->benchmark->elapsed_time()?> วินาที)</div>

<?php
foreach($query->result() as $rows){
?>
<div id="r_organization" style="margin-left:15px; width:851px; border-bottom:#D4D4D4 thin dotted; margin-top:10px;">
	<div id="cal" style="float:left; width:67px; height:58px; position:relative;">
    	<img src="<?=base_url()?>images/graphic/cal_search.png"/>
        <div id="months-years" style="position:absolute; top:5px; left:5px; width:57px; text-align:center; font-weight:bold; font-size:11px; color:#D1F5A0;"><?=$rows->months?>/<?=$rows->years?></div>
         <div id="dates" style="position:absolute; text-align:center; width:57px; bottom:7px; left:5px; font-weight:bold; font-size:16px; color:#333333;"><?=$rows->dates?></div>
    </div>	
    <div id="description" style="width:780px; float:right; margin-left:4px;">
    	<div id="c_org_title" style="font-size:13px; font-weight:bold;"><a href="<?=base_url()?>organization/view_details/<?=$rows->c_org_id?>"><?=$rows->c_org_title?></a></div>
        <div id="org_name" style="font-size:11px;">category &#8250; <?=$rows->org_name?> (<?=$rows->org_description?>)</div>
        <div id="staff-post" style="font-size:11px;">by &#8250; <?=$rows->firstname?> <?=$rows->lastname?></div>
    </div>
    <div id ="clear_both" style="clear:both;"></div>
</div>
<?php
} //end foreach
?>